﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace WebApplication.Controls
{
    public partial class UCTinTuc : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Display();
            }

        }
        private void Display()
        {
            int howManyPages = 0;
            string ID = Request.QueryString["IDTinTuc"] ?? "";
            string page = Request.QueryString["Page"] ?? "1";
            string firstPageUrl = "";
            string pagerFormat = "";

            List<Entities.TinTuc> data = TinTuc_BLL.TTPhanTrang(page, out howManyPages);
            dtl.DataSource = TinTuc_BLL.TTPhanTrang(page, out howManyPages); ;
            dtl.DataBind();
            firstPageUrl = LinkBLL.ToTinTuc("1");
            pagerFormat = LinkBLL.ToTinTuc("{0}");


            pagerBottom.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, true);
        }
    }
}